package customer.design.dispatcher.dispatchermode.util;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

/**
 * @author ldanniel
 */
@Component
public class SpringContextUtil implements ApplicationContextAware {
    @Autowired
    private ApplicationContext context;
    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        this.context=context;
    }
    //获取spring应用上下文（容器）-进而准备获取相应的bean
    public ApplicationContext getContext(){
        return context;
    }
}
